#include <stdio.h>
#include <pthread.h>
#include <stdlib.h>
#include <string.h>

typedef struct {
	int age;
	char name[64];
}perosn;

void* start_routine(void* args){
	printf("age=%d name=%s\n",((perosn*)args)->age,(*((perosn*)args)).name);
	perosn* p2=calloc(1,sizeof(perosn));
	p2->age=20;
	strcpy(p2->name,"zdx");	
	pthread_exit((void *)p2);
}
int main(){
	pthread_t thread;
	perosn p1={16,"yujiu"};
	int ret=pthread_create(&thread,NULL,start_routine,&p1);
	if(ret!=0){
		perror("pthread_create");
		exit(1);
	}
//	pthread_detach(thread);
	printf("thread_id=%ld\n",thread);
	perosn* p2=NULL;
    pthread_join(thread,(void *)&p2);
	printf("age=%d name=%s\n",p2->age,(*p2).name);
	free(p2);
	return 0;
}
